<?php

$strScreenName = 'EnterOrderHeader';
$strQueryName = 'qryAddOrderHeader';
$strFormName = 'frmEnterOrderHeader';

     if (($intOrderHeaderID) && (!$strReprocessing)) {
             include (MODULE . "/action/qrySelectOrderHeader");
             //$cboID = stripslashes($myrow["ID"]);
             $cboCustomer = stripslashes($myrow["Customer"]);
             $cboSalesChannel = $myrow["SalesChannel"];
             $txtOrderDate = ReformatFromMySqlDate($myrow["OrderDate"]);
             $txtShippedDate = ReformatFromMySqlDate($myrow["ShippedDate"]);
             $txtInvoiceDate = ReformatFromMySqlDate($myrow["InvoiceDate"]);
             $txtPaidDate = ReformatFromMySqlDate($myrow["PaidDate"]);
             $cboOrderStatus = stripslashes($myrow["OrderStatus"]);
             $cboCourier = stripslashes($myrow["Courier"]);
             $txtFreight = stripslashes($myrow["Freight"]);
             $txtShipName = stripslashes($myrow["ShipName"]);
             $txtShipAddress = stripslashes($myrow["ShipAddress"]);
             $txtShipAddress2 = stripslashes($myrow["ShipAddress2"]);
             $txtShipCity = stripslashes($myrow["ShipCity"]);
             $txtShipRegion = stripslashes($myrow["ShipRegion"]);
             $txtShipPostalCode = stripslashes($myrow["ShipPostalCode"]);
             $txtShipCountry = stripslashes($myrow["ShipCountry"]);
             $txtShipPhone = stripslashes($myrow["ShipPhone"]);
             $txtDeliveryName = stripslashes($myrow["DeliveryName"]);
             $txtDeliveryAddress = stripslashes($myrow["DeliveryAddress"]);
             $txtDeliveryAddress2 = stripslashes($myrow["DeliveryAddress2"]);
             $txtDeliveryCity = stripslashes($myrow["DeliveryCity"]);
             $txtDeliveryRegion = stripslashes($myrow["DeliveryRegion"]);
             $txtDeliveryPostalCode = stripslashes($myrow["DeliveryPostalCode"]);
             $txtDeliveryCountry = stripslashes($myrow["DeliveryCountry"]);
             $txtOtherInfo = stripslashes($myrow["OtherInfo"]);
         }else{
     }
if($strStyleSheet == TRUE){
	echo "<table class='Normal' border='0' align='left' width='100%'>";
}		 
     
echo "
<tr>
     <td>
         <table  width='640' cellpadding='0' cellspacing='0' border='0' class='Normal' align='center'>
     <tr align='left'>
         <td align='left' colspan='2'>
             <H2>Enter Order Shipping/Billing Details</H2>
         </td>
     </tr>
";
// Upploaded = 0
echo (StartForm($strScreenName, "post", $strQueryName,array('intOrderHeaderID'=>$intOrderHeaderID,'strReprocessing'=>'True'),"","",$strFormName,"","return frmEnterOrderHeader_onsubmit()"));

echo "
     <tr>
         <td align='right' colspan='2'>
             <input type='image' src='./images".SITE_SUFFIX."/save.gif' alt='Save'>
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Customer :&nbsp;</b>
         </td>
         <td align='left'>";
             CreateDropDown("cboCustomer", "SELECT ID, concat(Surname,', ',FirstName, ' ','- ref : ', ID) FROM tblCustomer ORDER BY 2", "", $cboCustomer);
echo "
             <a href='".ScreenURL("EnterCustomer")."' target='_blank'>+</a>
         </td>
     </tr>

	<tr>
         <td align='right'>
             <b>Sales Channel :&nbsp;</b>
         </td>
         <td align='left'>";
             CreateDropDown("cboSalesChannel", "SELECT * FROM tblSalesChannel ORDER BY 2", "", $cboSalesChannel);
echo "
         </td>
     </tr>";

	if(EXTRA_ORDER_FIELD){
		echo "
		     <tr>
		         <td align='right'>
		             <b>".EXTRA_ORDER_FIELD." :&nbsp;</b>
				 </td>
         		 <td align='left'>
		             <input type=\"text\" name=\"txtOtherInfo\" value = \"$txtOtherInfo\" size= \"80\" maxlength=\"100\">
		         </td>
		     </tr>
		";
	}

echo "
     <tr>
         <td align='right'>
             <b>Order Date :&nbsp;</b>
         </td>
         <td align='left'>
             <input type=\"text\" name=\"txtOrderDate\" value = '$txtOrderDate' size= \"10\" maxlength=\"10\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Shipped Date :&nbsp;</b>
         </td>
         <td align='left'>
             <input type=\"text\" name=\"txtShippedDate\" value = '$txtShippedDate' size= \"10\" maxlength=\"10\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Invoice Date :&nbsp;</b>
         </td>
         <td align='left'>
             <input type=\"text\" name=\"txtInvoiceDate\" value = '$txtInvoiceDate' size= \"10\" maxlength=\"10\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Date Paid :&nbsp;</b>
         </td>
         <td align='left'>
             <input type=\"text\" name=\"txtPaidDate\" value = '$txtPaidDate' size= \"10\" maxlength=\"10\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Order Status :&nbsp;</b>
         </td>
         <td align='left'>";
             CreateDropDown("cboOrderStatus", "SELECT * FROM tblOrderStatus ORDER BY 2", "", $cboOrderStatus);
echo "
             <a href='".ScreenURL("EnterOrderStatus")."' target='_blank'>+</a>
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Courier :&nbsp;</b>
         </td>
         <td align='left'>";
             CreateDropDown("cboCourier", "SELECT * FROM tblCourier ORDER BY 2", "", $cboCourier);
echo "
             <a href='".ScreenURL("EnterCourier")."' target='_blank'>+</a>
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Freight :&nbsp;</b>
         </td>
         <td align='left'>
           <input type=\"text\" name=\"txtFreight\" value = \"$txtFreight\" size= \"8\" maxlength=\"8\">
         </td>
     </tr>
	 
	 <tr colspan='2' align='left'>
	 	<td><b>Billing Address</b></td>
	 </tr>
	 
     <tr>
         <td align='right'>
             <b>Name :&nbsp;</b>
		</td>
         <td align='left'>
             <input type=\"text\" name=\"txtShipName\" value = \"$txtShipName\" size= \"25\" maxlength=\"40\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Address :&nbsp;</b><br/>
		 </td>
         <td align='left'>
             <input type=\"text\" name=\"txtShipAddress\" value = \"$txtShipAddress\" size= \"30\" maxlength=\"60\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Address2 :&nbsp;</b><br/>
		 </td>
         <td align='left'>
             <input type=\"text\" name=\"txtShipAddress2\" value = \"$txtShipAddress2\" size= \"30\" maxlength=\"60\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>City :&nbsp;</b>
         </td>
         <td align='left'>
           <input type=\"text\" name=\"txtShipCity\" value = \"$txtShipCity\" size= \"30\" maxlength=\"30\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Region :&nbsp;</b>
         </td>
         <td align='left'>
           <input type=\"text\" name=\"txtShipRegion\" value = \"$txtShipRegion\" size= \"25\" maxlength=\"25\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Postal Code :&nbsp;</b>
         </td>
         <td align='left'>
           <input type=\"text\" name=\"txtShipPostalCode\" value = \"$txtShipPostalCode\" size= \"10\" maxlength=\"10\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Country :&nbsp;</b>
         </td>
         <td align='left'>
           <input type=\"text\" name=\"txtShipCountry\" value = \"$txtShipCountry\" size= \"15\" maxlength=\"15\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Phone :&nbsp;</b>
         </td>
         <td align='left'>
           <input type=\"text\" name=\"txtShipPhone\" value = \"$txtShipPhone\" size= \"24\" maxlength=\"24\">
         </td>
     </tr>
	 
	 <tr colspan='2' align='left'>
	 	<td><b>Delivery Address</b></td>
	 </tr>
	 
     <tr>
         <td align='right' >
             <b>Delivery Name :&nbsp;</b>
		 </td>
		 <td>
             <input type=\"text\" name=\"txtDeliveryName\" value = \"$txtDeliveryName\" size= \"25\" maxlength=\"40\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Delivery Address :&nbsp;</b>
		 </td>
         <td align='left'>
             <input type=\"text\" name=\"txtDeliveryAddress\" value = \"$txtDeliveryAddress\" size= \"30\" maxlength=\"60\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Delivery Address :&nbsp;</b>
		 </td>
         <td align='left'>
             <input type=\"text\" name=\"txtDeliveryAddress2\" value = \"$txtDeliveryAddress2\" size= \"30\" maxlength=\"60\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Delivery City :&nbsp;</b>
         </td>
         <td align='left'>
           <input type=\"text\" name=\"txtDeliveryCity\" value = \"$txtDeliveryCity\" size= \"30\" maxlength=\"30\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Delivery Region :&nbsp;</b>
         </td>
         <td align='left'>
           <input type=\"text\" name=\"txtDeliveryRegion\" value = \"$txtDeliveryRegion\" size= \"25\" maxlength=\"25\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Delivery Postal Code :&nbsp;</b>
         </td>
         <td align='left'>
           <input type=\"text\" name=\"txtDeliveryPostalCode\" value = \"$txtDeliveryPostalCode\" size= \"10\" maxlength=\"10\">
         </td>
     </tr>

     <tr>
         <td align='right'>
             <b>Country :&nbsp;</b>
         </td>
         <td align='left'>
           <input type=\"text\" name=\"txtDeliveryCountry\" value = \"$txtDeliveryCountry\" size= \"15\" maxlength=\"15\">
         </td>
     </tr>
";

	
echo "
     <tr>
         <td align='right' colspan='2'>
             <input type='image' src='./images".SITE_SUFFIX."/save.gif' alt='Save'>
         </td>
     </tr>
         </table
     </form>
     </td>
 </tr>
";
	if($strStyleSheet == TRUE){
   		echo "</table>";
	}
     //$strListAll = "true";
       //include (MODULE . "/screen/ListOrderHeader");
?>
<script language="JavaScript">
<!--
function frmEnterOrderHeader_onsubmit() 
{


     if(document.frmEnterOrderHeader.txtShipAddress.value == "") {
         alert("Please enter Address");
         document.frmEnterOrderHeader.txtShipAddress.focus();
         document.frmEnterOrderHeader.txtShipAddress.select();
         return(false);
     }

     if(document.frmEnterOrderHeader.txtShipCity.value == "") {
         alert("Please enter City");
         document.frmEnterOrderHeader.txtShipCity.focus();
         document.frmEnterOrderHeader.txtShipCity.select();
         return(false);
     }

     if(document.frmEnterOrderHeader.txtShipRegion.value == "") {
         alert("Please enter Region");
         document.frmEnterOrderHeader.txtShipRegion.focus();
         document.frmEnterOrderHeader.txtShipRegion.select();
         return(false);
     }

     if(document.frmEnterOrderHeader.txtShipPostalCode.value == "") {
         alert("Please enter Postal Code");
         document.frmEnterOrderHeader.txtShipPostalCode.focus();
         document.frmEnterOrderHeader.txtShipPostalCode.select();
         return(false);
     }

     if(document.frmEnterOrderHeader.txtShipCountry.value == "") {
         alert("Please enter Country");
         document.frmEnterOrderHeader.txtShipCountry.focus();
         document.frmEnterOrderHeader.txtShipCountry.select();
         return(false);
     }

     if(document.frmEnterOrderHeader.txtShipPhone.value == "") {
         alert("Please enter Phone");
         document.frmEnterOrderHeader.txtShipPhone.focus();
         document.frmEnterOrderHeader.txtShipPhone.select();
         return(false);
     }
	 
     if(document.frmEnterOrderHeader.txtDeliveryAddress.value == "") {
         alert("Please enter Delivery Address");
         document.frmEnterOrderHeader.txtDeliveryAddress.focus();
         document.frmEnterOrderHeader.txtDeliveryAddress.select();
         return(false);
     }

     if(document.frmEnterOrderHeader.txtDeliveryCity.value == "") {
         alert("Please enter Delivery City");
         document.frmEnterOrderHeader.txtDeliveryCity.focus();
         document.frmEnterOrderHeader.txtDeliveryCity.select();
         return(false);
     }

     if(document.frmEnterOrderHeader.txtDeliveryRegion.value == "") {
         alert("Please enter Delivery Region");
         document.frmEnterOrderHeader.txtDeliveryRegion.focus();
         document.frmEnterOrderHeader.txtDeliveryRegion.select();
         return(false);
     }

     if(document.frmEnterOrderHeader.txtDeliveryPostalCode.value == "") {
         alert("Please enter Delivery Postal Code");
         document.frmEnterOrderHeader.txtDeliveryPostalCode.focus();
         document.frmEnterOrderHeader.txtDeliveryPostalCode.select();
         return(false);
     }

}
// -->
</script>
